<!-- $Id: addPosts.html 121 2011-05-17 10:03:49Z nicholasinlove1986@gmail.com $ -->
<include file="Public:pageheader"/>
<link href="__PUBLIC__/Css/uploadify.css" rel="stylesheet" type="text/css" />
<load href="__PUBLIC__/Js/validator.js" />
<load href="__PUBLIC__/Js/tagto.js" />
<load href="__PUBLIC__/Editor/kindeditor.js" />
<load href="__PUBLIC__/Editor/kindsoft-plugin.js" />
<load href="__PUBLIC__/Uploadify/swfobject.js" />
<load href="__PUBLIC__/Uploadify/jquery.uploadify.v2.1.4.min.js" />
<load href="__PUBLIC__/Js/domTT/domLib.js" />
<load href="__PUBLIC__/Js/domTT/fadomatic.js" />
<load href="__PUBLIC__/Js/domTT/domTT.js" />
<script language="javascript">
/**
* 初始化编辑器
*/
KE.show({
	id : 'posts_content',
	imageUploadJson : '__APP__/Upload/uploadImage',
	fileManagerJson : '__APP__/Upload/fileManager',
	allowFileManager : true,
	width : '100%',
	resizeMode : 1
});

KE.show({
	id : 'posts_abstract',
	imageUploadJson : '__APP__/Upload/uploadImage',
	fileManagerJson : '__APP__/Upload/fileManager',
	resizeMode : 1,
	allowFileManager : true,
	width : '100%'
});

/**
* jQuery
*/
$(function(){

	$('#title').blur(function(){
		//$('#posts_url').val(encodeURIComponent($('#title').val()));
		$('#posts_url').val(encodeURIComponent($('#title').val().replace(/[ ]/g,"-")));
	});
   
	$('#havaTag').toggle(function(){
		$('#tagBox').show('fast');
		$(this).text('[-][{$Think.lang.clost_havaTag}]');
	},function(){
		$('#tagBox').fadeOut();
		$(this).text('[+][{$Think.lang.havaTag}]');
	}); 
	
	/*$('.tag').click(function(){
	     var old=$('#tag_name').val();
		 if(old!=''){
		   old=old+',';
		 }
		 var str=$(this).text();
	     $('#tag_name').val(old+str);
	 });*/
	 
	 $("#tagBox").tagTo("#tag_name");
	 
	$('#uploadfile').uploadify({
		'uploader'       : '__PUBLIC__/Uploadify/uploadify.swf',
		'script'         : '__APP__/Upload/fileUpload',
		'cancelImg'      : '__PUBLIC__/Uploadify/cancel.png',
		'multi'          : true,
		'auto'           : false,
		'fileExt'        : '*.doc;*.pdf;*.rar;*.zip',
		'fileDesc'       : '{$Think.lang.fileDesc}',
		'queueID'        : 'fileQueue',
		'queueSizeLimit' : 5,
		'simUploadLimit' : 5,
		'sizeLimit'      : {$allow_max_size_b}, 
		'onSelectOnce'   : function(event,data) {
			$('#status-message').text(data.filesSelected + ' files have been added to the queue.');
		},	
		'onComplete'     : function(event,queueID,fileObj,response,data){
			//var ahtml="<span class=download><a href='"+response+"' target=_blank>[点击下载]</a></span>";
			var html="<li><a href='javascript:void(0)' onMouseOver=\"this.style.color = '#D17E62'; domTT_activate(this, event, 'content', '&lt;SPAN class=download&gt;&lt;A href='"+response+"' target=_blank&gt;[{$Think.lang.hit_download}]&lt;/A&gt;&lt;/SPAN&gt', 'trail', true, 'fade', 'both', 'fadeMax', 87, 'styleClass', 'niceTitle');\" onMouseOut=\"this.style.color = ''; domTT_mouseout(this, event);\">"+fileObj.name+"</a>&nbsp;-&nbsp;-&nbsp;-&nbsp;-&nbsp;<a href='javascript:void(0)' onclick=\"javascript:KE.insertHtml('posts_content', '<SPAN class=download><A href="+response+">[{$Think.lang.hit_download}]</A></SPAN>');\">[{$Think.lang.show_download}]</a>&nbsp;|&nbsp;<a href='__APP__/Upload/uploadManager/' target=_blank>[{$Think.lang.get_download_code}]</a></li>";		
			$('#filelist').append(html);
		},
		'onAllComplete'  : function(event,data) {
			 $('#status-message').text(data.filesUploaded + ' files uploaded, ' + data.errors + ' errors.');
		}
	});
	  
});

/**
* 检查表单输入的数据
*/
function validate() {
	validator = new Validator("theForm");	
	validator.required("posts_title","{$Think.lang.js_posts_title}");
	validator.required("posts_url","{$Think.lang.js_posts_url}");
	validator.required("category_id","{$Think.lang.js_category_id}");
	validator.required("posts_content","{$Think.lang.js_posts_content}");
	return validator.passed();
}

/**
* 文本框高度变化
*/
function bigger(obj) {
	var $obj = $('#'+obj);
	if(!$obj.is(":animated")) {
		if($obj.height()<500) {
			$obj.animate({height : "+=50"},400);
		}
	}
}

function smaller(obj) {
	var $obj = $('#'+obj);
	if(!$obj.is(":animated")) {
		if($obj.height()>50) {
			$obj.animate({height : "-=50"},400);
		}
	}
}
</script>

<div class="tab-div">
  <div id="tabbar-div">
    <p> <span class="tab-front" id="base-tab">{$Think.lang.tabbar_base}</span><span class="tab-back" id="content-tab">{$Think.lang.tabbar_content}</span><span class="tab-back" id="seo-tab">{$Think.lang.tabbar_seo}</span></p>
  </div>
  <div id="tabbody-div">
    <form action="__URL__/insertPosts" method="post" name="theForm"  id="theForm" enctype="multipart/form-data" onSubmit="return validate()">
      <table width="90%" id="base-table">
        <tr>
          <td class="narrow-label">{$Think.lang.posts_title}</td>
          <td><input type="text" name="posts_title" size="45" maxlength="60" id="title"/>
            <span class="require-field">*</span></td>
        </tr>
        <tr class="narrow-label">
          <td class="label"><a href="javascript:showNotice('url');" title="{$Think.lang.notic}"><img src="__PUBLIC__/Images/notice.gif" width="16" height="16" border="0"></a> {$Think.lang.posts_url}</td>
          <td><input type="text" size="45" name="posts_url" id="posts_url" />
            <span class="require-field">*</span><br />
            <span class="notice-span" style="display:block" id="url">{$Think.lang.posts_url_notic}:<br />
            <code style="background:#DDEEF2;">{&blog_domain}?p=123</code><br />
			<code style="background:#DDEEF2;">{&blog_domain}2011/05/sample-post/</code><br />
            <code style="background:#DDEEF2;">{&blog_domain}posts/sample-post/</code></span> </td>
        </tr>
        <tr>
          <td class="narrow-label"><a href="javascript:showNotice('tag');" title="{$Think.lang.notic}"><img src="__PUBLIC__/Images/notice.gif" width="16" height="16" border="0"></a> {$Think.lang.tag_name}</td>
          <td><input type="text" name="tag_name" size ="45" maxlength="60" id="tag_name"/>
            &nbsp;&nbsp;<span id="havaTag">[+][{$Think.lang.havaTag}]</span>
            <div id="tagBox" style="display:none;">
              <volist name="tag_name" id="t"> <a href="#" class="tag" style="font-size:<php>echo random_size(get_uid(1));</php>;">{$t.tag_name}</a> </volist>
            </div>
            <span class="notice-span" style="display:block" id="tag"> {$Think.lang.havaTag_notic}</span> </td>
        </tr>
        <tr>
          <td class="narrow-label">{$Think.lang.posts_author}</td>
          <td><select name="posts_author">
            {$nick_name}
            </select></td>
        </tr>
        <tr>
          <td class="narrow-label">{$Think.lang.category_id}</td>
          <td><select name="category_id">  
            {$cat_option}
            </select><a href="__APP__/Category/addCat" title="{$Think.lang.addCat}" class="special" target="main-frame">{$Think.lang.addCat}</a></td>
        </tr>
        <tr>
          <td class="narrow-label">{$Think.lang.posts_stick}</td>
          <td><input type="radio" name="posts_stick" value="0" checked />{$Think.lang.no}
            <input type="radio" name="posts_stick" value="1" />{$Think.lang.yes}
			</td>
        </tr>
        <tr>
          <td class="narrow-label">{$Think.lang.posts_allowcom}</td>
          <td><input type="radio" name="posts_allowcom" value="0" />{$Think.lang.no}
            <input type="radio" name="posts_allowcom" value="1" checked />{$Think.lang.yes}
			</td>
        </tr>
		<tr>
          <td class="narrow-label">{$Think.lang.posts_istrack}</td>
          <td><input type="radio" name="posts_istrack" value="0" />{$Think.lang.no}
            <input type="radio" name="posts_istrack" value="1" checked />{$Think.lang.yes}
			</td>
        </tr>
        <tr>
          <td class="narrow-label">{$Think.lang.posts_draft}</td>
          <td><input type="radio" name="posts_draft" value="1" checked />{$Think.lang.posts_draft_1}
            <input type="radio" name="posts_draft" value="0" />{$Think.lang.posts_draft_2}
			</td>
        </tr>
		<tr>
          <td class="narrow-label"><a href="javascript:showNotice('trackback');" title="{$Think.lang.notic}"><img src="__PUBLIC__/Images/notice.gif" width="16" height="16" border="0"></a> {$Think.lang.posts_trackback}</td>
          <td><textarea name="posts_trackback" id="pt" cols="48" rows="3"></textarea><b>&nbsp;&nbsp;<a href="javascript:bigger('pt');">[+]</a>&nbsp;&nbsp;<a href="javascript:smaller('pt');">[-]</a></b><br /><span class="notice-span" style="display:block" id="trackback">{$Think.lang.posts_trackback_notic}</span> </td>
        </tr>
        <tr>
          <td class="narrow-label">{$Think.lang.posts_abstract}</td>
          <td><textarea name="posts_abstract" id="posts_abstract" style="height:165px;"></textarea></td>
        </tr>
      </table>
      <table id="content-table" style="display: none;" width="90%" align="center";>
        <tr>
          <td class="narrow-label"><textarea id="posts_content" name="posts_content"  style="width:100%;height:285px;" ></textarea></td>
        </tr>
		<tr>
    <td>
      <div style="font-weight:bold; padding-top:15px;"><img src="__PUBLIC__/Images/notice.gif" width="16" height="16" border="0" /> {$Think.lang.about_att}</div>
       <ul>
		 <li>{$Think.lang.about_att_1}</li>
		 <li>{$Think.lang.about_att_2}</li>	
		 <li>{$Think.lang.about_att_3}</li>
		 <li>{$Think.lang.about_att_4}</li>	
		 <li>{$Think.lang.about_att_5}: {$allow_max_size}</li>		 	
       </ul>
    </td>
	 </tr>
        <tr>
          <td style=" padding:5px; margin:5px; padding-left:50px;">
		    <div id="status-message"></div>
            <div id="fileQueue"></div></td>
        </tr>
        <tr>
          <td style=" padding:5px; margin:5px; padding-left:50px;"><input type="file" name="uploadfile" id="uploadfile"></td>
        </tr>
        <tr>
          <td style=" padding:5px; margin:5px; padding-left:50px;"><a href="javascript:$('#uploadfile').uploadifyUpload();">[{$Think.lang.uploadifyUpload}]</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="javascript:$('#uploadfile').uploadifyClearQueue();">[{$Think.lang.uploadifyClearQueue}]</a>
</td>
        </tr>
		<tr>
          <td style=" padding:5px; margin:5px; padding-left:50px;"><ul id="filelist"></ul></td>
        </tr>
      </table>
      <table id="seo-table"  style="display: none;" width="90%">
        <tr>
          <td width="66%" class="narrow-label"><a href="javascript:showNotice('seoti');" title="{$Think.lang.notic}"><img src="__PUBLIC__/Images/notice.gif" width="16" height="16" border="0"></a> {$Think.lang.posts_seoti}:</td>
          <td width="34%"><input type="text" name="posts_seoti" size="40"/>
            <br />
            <span class="notice-span" style="display:block" id="seoti">{$Think.lang.posts_seoti_notic}</span> </td>
        </tr>
        <tr>
          <td class="narrow-label"><a href="javascript:showNotice('seokw');" title="{$Think.lang.notic}"><img src="__PUBLIC__/Images/notice.gif" width="16" height="16" border="0"></a> {$Think.lang.posts_seokw}:</td>
          <td><input type="text" name="posts_seokw" size="50"/>
            <br />
            <span class="notice-span" style="display:block" id="seokw">{$Think.lang.posts_seokw_notic}</span> </td>
        </tr>
        <tr>
          <td class="narrow-label"><a href="javascript:showNotice('seodesc');" title="{$Think.lang.notic}"><img src="__PUBLIC__/Images/notice.gif" width="16" height="16" border="0"></a> {$Think.lang.posts_seodesc}:</td>
          <td><textarea name="posts_seodesc" rows="6" cols="48"></textarea>
            <br />
            <span class="notice-span" style="display:block" id="seodesc">{$Think.lang.posts_seodesc_notic}</span> </td>
        </tr>
      </table>
      <div class="button-div">
        <input value=" {$Think.lang.submit} " class="button" type="submit">
        <input value=" {$Think.lang.reset} " class="button" type="reset">
		<input type="hidden" name="posts_type" value="1" />
        <input type="hidden" name="act" value="do" />
      </div>
    </form>
  </div>
</div>
<load href="__PUBLIC__/Js/tab.js" />
<include file="Public:pagefooter"/> 